package ar.com.utn.openqsb.lip.ui;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JToolBar;

import ar.com.utn.openqsb.commons.util.Utility;

public class ToolBarFactory
{

    public static void createToolBar(final ExerciseFrame mainFrame)
    {
        JToolBar toolBar = new JToolBar();

        JButton buttonSave = new JButton("Guardar", Utility.getIcon("ar/com/utn/openqsb/lip/icons/save.png"));
        buttonSave.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent e)
            {
                mainFrame.save();
            }
        });
        toolBar.add(buttonSave);

        JButton buttonSolve = new JButton("Resolver", Utility.getIcon("ar/com/utn/openqsb/lip/icons/play.png"));
        buttonSolve.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent e)
            {
                mainFrame.solve();
            }
        });
        toolBar.add(buttonSolve);

        JButton buttonChart = new JButton("Graficar", Utility.getIcon("ar/com/utn/openqsb/lip/icons/chart.png"));
        buttonChart.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent e)
            {
                mainFrame.chart();
            }
        });
        toolBar.add(buttonChart);

        mainFrame.add(toolBar, BorderLayout.NORTH);
    }
}
